import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView";
Vue.use(VueRouter);

const routes = [
    {
        path: "/",
        name: "home",
        component: HomeView,
    },
    
    {
        path: "/video",
        name: "video",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ "../views/VideoView.vue"),
    },

    {
        path: "/activity",
        name: "activity",
        component: () => import(/* webpackChunkName: "about" */ "../views/ActivityView.vue"),
    },

    {
        path: "/collect",
        name: "collect",
        component: () => import(/* webpackChunkName: "about" */ "../views/CollectView.vue"),
    },
    // 设置路由，获取图片的id进行动态绑定
    {
        path: "/dishesofdetail/:foodid",
        name: "dishesofdetail",
        props: true,
        component: () => import("../views/DishesOfDetailView.vue"),
    },
];

const router = new VueRouter({
    mode: "hash",
    base: process.env.BASE_URL,
    routes,
});

export default router;
